<?php 
	ob_start(); session_start(); 
	require_once('adminpanel/config/setting.php');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Questions</title>
</head>
<style>
	.topmenu{
		font-family:arial;
		font-size:14px;
		color:#FFFFFF;
		text-decoration:none;
	}
	.topmenu:hover{
		font-family:arial;
		font-size:14px;
		color:#FFFFFF;
		text-decoration:underline;
	}
</style>

<?php 
	if($_POST['regsubmit']){
		$asknow = $_POST['asknow'];
		$askdetail = $_POST['askdetail'];
		$datein = time();
		$mid = $_SESSION['memberid'];
		mysql_query("insert into tbl_question (id,mid,question,detail,dateposted) values ('','$mid','$asknow','$askdetail','$datein')") or die (mysql_error());
	}
?>

<body style="margin:0px; background-color:#f1f1f1">
	<div id="header" style="background:url(images/top-bg.png) repeat-x; " align="center">
    	<div style="width:982px;" >
        	<div style="padding-top:30px; padding-right:20px; color:#FFFFFF" align="right">
            	<img src="images/the-century-logo.png" style="position:absolute; top:10px; margin-left:-450px;" />
            	<a href="index.php" class="topmenu">Home</a> &nbsp; | &nbsp; 
                <a href="about-us.php" class="topmenu">About Us</a> &nbsp; | &nbsp; 
                <a href="questions.php" class="topmenu">Questions</a> &nbsp; | &nbsp; 
                <a href="reservation.php" class="topmenu">Reservation</a> &nbsp; | &nbsp; 
				<a href="menu.php" class="topmenu">Menu</a> &nbsp; | &nbsp; <?php if(!($_SESSION['username'])){?>
                <a href="signup.php" class="topmenu">Signup</a><?php } else {?>
                <a href="logout.php" class="topmenu">Logout</a><?php }?>
                <br />
                <?php 
                include('login.php');
				?>            
            </div>
        	<img src="images/top-gradient.png" />
            <?php if(!($_POST['regsubmit'])){ ?>
            <div style="position:absolute; top:150px; margin-left:50px; font-size:24px; color:#F00 ">What is your Question?</div>
            <?php } ?>
        </div>
    </div>
	<div id="body" align="center">
    	<div style="width:982px" align="center">
            <div style="width:900px;margin-left:0px; line-height:18px; font-family:verdana; font-size:12px; color:#666" align="left" >
            <?php if($_POST['regsubmit']){ echo '<span style="font-size:18px; color:red">Your Question is successfully submitted...</span>'; }else{ ?>
            	<form name="qform" method="post" >                
                    <input name="asknow" value="<?=$_POST['asknow']?>" style="width:400px; font-size:18px" /><br /><br />
                    Add a little more detail(optional):<br />
                    <textarea name="askdetail" style="width:400px; height:200px"></textarea><br /><br>
                    
                    <input type="submit" name="regsubmit" value="Continue" onclick="return validateField();" style="height:40px; width:150px;" />
		         </form>    
            <?php } ?>    
            </div>
        </div>
    </div>
    <div id="footer" style="background:url(images/btm-bg.png) repeat-x; height:166px" align="center">
    	<div style="width:982px">
        	<div style="height:40px"></div>
        	<img src="images/btm-gradient.png" />
        </div>
    </div>
	<script>
        function validateField(){
            var emptyfield = '';
            
            if(document.qform.asknow.value.trim()==''){
                emptyfield += ' Your Question \n';
            }
            if(emptyfield==''){
                return true;				
            }else{
                alert('Please complete required fields: \n'+emptyfield);
                return false;
            }
        }
    
    </script>        
</body>
</html>